package com.hnkywl.sts.action.xsgl;

import com.hnkywl.sts.entity.sys.Gncz;
import com.hnkywl.sts.service.sys.GnczService;
import com.hnkywl.sts.service.xsgl.JfmxService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Calendar;
import java.util.List;

/**
 * Created by HL on 2015/9/8.
 */
@Namespace("/xsgl/jfmx")
public class JfmxAction extends SimpleActionSupport {
    private JfmxService jfmxService;
    //功能操作
    private GnczService gnczService;
    private List<Gncz> gnczList;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows;

    @Action("jfmx")
    public String jfmx() {
        return SUCCESS;
    }

    @Action("jfmxList")
    public void jfmxList() {
        this.renderJson(this.jfmxService.findJfmxList(page, rows));
    }

    @Action("jfmx_tx")
    public void jfmxTx() {
        try {

            renderText("{\"statusCode\":\"200\", \"message\":\"计算贴息成功!\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public List<Gncz> getGnczList() {
        return gnczList;
    }

    public void setGnczList(List<Gncz> gnczList) {
        this.gnczList = gnczList;
    }

    @Autowired
    public void setJfmxService(JfmxService jfmxService) {
        this.jfmxService = jfmxService;
    }

    @Autowired
    public void setGnczService(GnczService gnczService) {
        this.gnczService = gnczService;
    }
}
